//
//  GoodsTypeButton.m
//  Shengzhuli
//
//  Created by FXGuo on 2017/4/7.
//  Copyright © 2017年 kamangkeji. All rights reserved.
//

#import "GoodsTypeButton.h"

@interface GoodsTypeButton()

@property (nonatomic,strong) UIColor *normalColor;
@property (nonatomic,strong) UIColor *selectColor;
@property (nonatomic,strong) UIColor *HighlightColor;
@property (nonatomic,strong) UIColor *normalBorderColor;
@property (nonatomic,strong) UIColor *selectBorderColor;

@property (nonatomic,weak) UIImageView *selectImageView;

@end

@implementation GoodsTypeButton

- (instancetype)initWithFrame:(CGRect)frame
{
    if (self = [super initWithFrame:frame]) {
        self.layer.borderWidth = 1;
        self.layer.cornerRadius = 5.0;
        self.clipsToBounds = YES;
        UIImageView *selectImageView = [[UIImageView alloc]initWithFrame:CGRectMake(3, 0, 10, 10)];
        selectImageView.image = GetImage(@"typeSelect");
        [self addSubview:selectImageView];
        selectImageView.hidden = YES;
        self.selectImageView = selectImageView;
    }
    return self;
}
- (void)setSelected:(BOOL)selected
{
    [super setSelected:selected];
    self.selectImageView.hidden = !selected;
}

- (void)setBackgroundColor:(nullable UIColor *)color forState:(UIControlState)state
{
    if (state == UIControlStateNormal) {
        self.normalColor = color;
        self.backgroundColor = color;
    }else if (state == UIControlStateSelected){
        self.selectColor = color;
    }
}
- (void)setBorderColor:(nullable UIColor *)color forState:(UIControlState)state
{
    if (state == UIControlStateNormal) {
        self.normalBorderColor = color;
    }else if (state == UIControlStateSelected){
        self.selectBorderColor = color;
    }
}


@end
